<template>
    <div id="login" v-loading="loading">
      <div class="title">宝山提审会见</div>
      <div class="login-container">
        <div class="form-container">
          <el-form ref="form" :model="model" :rules="rules">
            <el-form-item prop="account">
              <el-input v-model="model.account" placeholder="请输入账号"></el-input>
            </el-form-item>
            <el-form-item prop="password">
              <el-input type="password" v-model="model.password" placeholder="请输入密码"></el-input>
            </el-form-item>
          </el-form>
          <div class="btn-login" @click="login">登录</div>
        </div>
      </div>
    </div>
</template>
<script>
export default {
  name: 'Login',
  data () {
    return {
      model: {
        account: '',
        password: ''
      },
      rules: {
        account: { required: true, message: '请输入账号', trigger: 'blur' },
        password: { required: true, message: '请输入密码', trigger: 'blur' }
      },
      loading: false
    }
  },
  methods: {
    login () {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.loading = true
          this.$http.POST('Interviewer:Login', this.model).then(res => {
            if (res.data.code === 200) {
              this.$router.push(res.data.data)
            } else {
              this.loading = false
              this.$message.error(res.data.msg)
            }
          })
        }
      })
    }
  }
}
</script>

<style scoped>
  * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  #login {
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#cee3fd, #6cc0fc, #018cf1);
  }
  .title{
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 48px;
    color: #eee;
    top: 250px;
  }
  .login-container{
    position: absolute;
    width: 500px;
    height: 300px;
    border-radius: 5px;
    left: calc(50% - 250px);
    top: 300px;
  }
  .form-container{
    width: 400px;
    height: 200px;
    margin-left: 50px;
    margin-top: 50px;
  }
  .btn-login{
    width: 100%;
    line-height: 40px;
    color: #eee;
    background-color: #409EFF;
    border-radius: 4px;
    text-align: center;
    margin-top: 26px;
    cursor: pointer;
    letter-spacing: 20px;
    transition: background-color .2s;
  }
  .btn-login:hover{
    background-color: #66b1ff;
  }
</style>
